$(function(){
    //获取id
    var id = tools.queryString().id || 1;
    //获取主题数据,动态渲染
    $.ajax({
        type: "get",
        // url: domain.test + "/gettheme",
        url:domain.online + "/api/theme",
        data:{id:id},
        success:function(data){
            // if(data.data.rtnCode === 200) {
            if(data.rtnCode === 200) {
                // var themeDetail = data.data.data;
                var themeDetail = data.data;
                document.title = themeDetail.title;
                $(".themeMsg").html(template("themeMsg",{themeDetail:themeDetail}));
                $(".productList").html(template("productList",{plist:themeDetail.plist}));
            }
        }
    });
    //点击查看商品详情
    $(".productList").on("click",".productItem",function(){
        var pID = $(this).attr("data-id");
        location.href = "../classify/product.html?id=" + pID;
    });
});